import http from '@/http/http'
import { AddMenuModel, MenuListParam, MenuParam } from './MenuModel'
enum Api {
    getRouteMenuList = '/api/v1/user/getRouteMenuList',
    getMenuList = '/api/v1/menu/getMenuList',
    getParent = '/api/v1/menu/parent',
    addAndEditAndDel = '/api/v1/menu/menu',
    getSort = '/api/v1/menu/getSort'
}
// 获取菜单
export const getMenuListApi = async () => {
    return await http.get(Api.getRouteMenuList)
}
// 获取菜单列表
export const getMenuTableApi = async (param: MenuListParam) => {
    return await http.get(Api.getMenuList, param)
}
// 获取上级菜单
export const getParentMenuApi = async () => {
    return await http.get(Api.getParent)
}
// 获得子菜单sort最大值
export const getMenuSortApi = async (param: MenuParam) => {
    return await http.getRestApi(Api.getSort, param)
}
// 新增
export const addMenuApi = async (param: AddMenuModel) => {
    return await http.post(Api.addAndEditAndDel, param)
}
// 编辑
export const editMenuApi = async (param: AddMenuModel) => {
    return await http.put(Api.addAndEditAndDel, param)
}
// 删除
export const delMenuApi = async (param: MenuParam) => {
    return await http.delete(Api.addAndEditAndDel, param)
}
